﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PersonEmpWorkInfo.aspx.cs"
    Inherits="RN.ERP.Web.Person.PersonEmpWorkInfo" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title><%=PageTitle %></title>
    <link href="../Styles/skins/blue/css/style.css" rel="stylesheet" type="text/css" />
    <link href="../Styles/skins/blue/css/style_msg.css" rel="stylesheet" type="text/css" />
    <link rel="Stylesheet" type="text/css" href="../Scripts/ligerUI/skins/Aqua/css/ligerui-all.css" />
    <script src="../Scripts/jquery.min.js" type="text/javascript"></script>
    <script type="text/javascript" language="javascript" src="../Scripts/json-data.js"></script>
    <script type="text/javascript" src="../Scripts/iepngfix_tilebg.js"></script>
    <script src="../My97DatePicker/WdatePicker.js" type="text/javascript"></script>
     <script type="text/javascript" src="../Scripts/ligerUI/js/ligerui.min.js"></script>
    <style>
        .IE6png
        {
            behavior: url("../Scripts/iepngfix.htc");
        }
    </style>
    <script type="text/javascript">
    </script>
</head>
<body>
    <form id="form1" runat="server">
      <input id="hdStatus" type="hidden" runat="server" value="0" />
    <input type="hidden" id="hidCorpGuid" runat="server" />
     <input type="hidden" id="hidCorpName" runat="server" />
      <input type="hidden" id="hidCurrentCorpName" runat="server" value="" />
    <table width="770" border="0" cellspacing="0" cellpadding="0" align="center">
        <tr>
            <td width="16" class="title_lbg IE6png">
            </td>
            <td width="24" class="title_t IE6png">
            </td>
            <td width="713" class="title_libg IE6png">
                工作经历
            </td>
            <td width="17" class="title_rbg IE6png">
            </td>
        </tr>
        <tr>
            <td class="border_lbg IE6png">
                &nbsp;
            </td>
            <td colspan="2">
                <div id="con">
                    <ul id="tags">
                        <li class="selectTag"><a href="#">工作经历</a> </li>
                    </ul>
                    <div id="tagContent">
                        <div class="tagContent selectTag"  id="workexperience" table="tb_workexperience"
                            valtype="0">
                            <table width="100%" border="0" cellspacing="0" cellpadding="0" class="xx_tab">

                                <tr>
                                    <td align="right" width="67" >
                                        起始时间
                                           <input id="hdEmpGuid" type="hidden" runat="server" value="" control="EmpGuid" />
                                        <input id="hdID" type="hidden" runat="server" value="0" control="ID" />
                                    </td>
                                    <td >
                                        <div class="s_input">
                                            <span class="input_l">
                                                <img src="../images/input_l.jpg" width="10" height="31" alt="" />
                                            </span>
                                            <span class="input_mm">
                                                <input id="txtBeginDate" name="txtBeginDate" type="text" value="" style="width: 275px; height: 31px;
                                                     line-height: 31px; border: 0; background: transparent; overflow: hidden" onclick="WdatePicker({skin:'blue',maxDate:'#F{$dp.$D(\'txtEndDate\')||\'%y-%M-{%d-1}\'}',dateFmt:'yyyy-MM'})" 
                                                     control="BeginDate" controlvalid="checkEmpty(this,'')" controltext="起始时间" maxlength="7"/>
                                            </span>
                                            <span class="input_r">
                                                <img src="../images/input_r.jpg" width="10" height="31" alt="" />
                                            </span>
                                        </div>
                                    </td>
                                    <td width="67" align="right">
                                        截止时间
                                    </td>
                                    <td>
                                        <div class="s_input">
                                            <span class="input_l">
                                                <img src="../images/input_l.jpg" width="10" height="31" alt="" />
                                            </span>
                                            <span class="input_mm">
                                                <input id="txtEndDate" name="txtEndDate"  type="text" value="" style="width: 275px; height: 31px;
                                                     line-height: 31px; border: 0; background: transparent; overflow: hidden"   onclick="WdatePicker({skin:'blue',minDate:'#F{$dp.$D(\'txtBeginDate\')}',maxDate:'%y-%M-%d',dateFmt:'yyyy-MM'})" 
                                                       control="EndDate"  controlvalid="checkEmpty(this,'')" controltext="截止时间" maxlength="7"/>
                                            </span>
                                            <span class="input_r">
                                                <img src="../images/input_r.jpg" width="10" height="31" alt="" />
                                            </span>
                                        </div>
                                    </td>
                                    <td>
                                        <input id="CheckEndTime" type="checkbox" value="1" /><span style="color:Red;">至今</span>
                                    </td>
                                </tr>
                                <tr>
                                    <td width="67" align="right">
                                        单位名称
                                    </td>
                                    <td >
                                        <div class="s_input">
                                            <span class="input_l">
                                                <img src="../images/input_l.jpg" width="10" height="31" alt="" />
                                            </span>
                                            <span class="input_mm">
                                                <input id="txtCorpName" name="txtCorpName" type="text" style="width: 275px; height: 31px; line-height: 31px;
                                                    border: 0; background: transparent"   control="CorpName"  maxlength="50" controlvalid="checkEmpty(this,'')" controltext="单位名称"/>
                                            </span>
                                            <span class="input_r">
                                                <img src="../images/input_r.jpg" width="10" height="31" alt="" />
                                            </span>
                                        </div>
                                    </td>
                                    <td width="67" align="right">
                                        职务
                                    </td>
                                    <td colspan="2">
                                        <div class="s_input">
                                            <span class="input_l">
                                                <img src="../images/input_l.jpg" width="10" height="31" alt="" />
                                            </span>
                                            <span class="input_mm">
                                                <input id="txtPost" name="txtPost"  type="text" value="" style="width: 275px; height: 31px; line-height: 31px;
                                                    border: 0; background: transparent"   control="Post"  maxlength="50"/>
                                            </span>
                                            <span class="input_r">
                                                <img src="../images/input_r.jpg" width="10" height="31" alt="" />
                                            </span>
                                        </div>
                                    </td>
                                   
                                </tr>
                            </table>
                            <table  height="80" border="0" align="center" cellpadding="0" cellspacing="0" class="xx_tab">
                                <tr>
                           
                                    <td width="144" height="80">
                                        <div class="icon01 IE6png">
                                            <a id="btnSave" parentdiv="workexperience" href="javascript:void(0);">保存</a>
                                        </div>
                                    </td>
                                    <td width="11" height="80">&nbsp;</td>
                                    <td width="144" height="80">
                                        <div class="icon02 IE6png">
                                            <a id="btnCancel" href="javascript:void(0);">关闭</a>
                                        </div>
                                    </td>
                                  <%--   <td width="11" height="80">&nbsp;</td>
                                    <td width="144" height="80">
                                        <div class="icon02 IE6png">
                                            <a id="btnNewOne" href="javascript:void(0);">添加下一条</a>
                                        </div>
                                    </td>--%>
                                </tr>
                            </table>
                        </div>
                    </div>
                </div>
            </td>
            <td class="border_rbg IE6png">&nbsp;</td>
        </tr>
        <tr>
            <td class="border_lconer IE6png" headers="17">
                &nbsp;
            </td>
            <td colspan="2" class="border_bottomli IE6png" height="17">
                &nbsp;
            </td>
            <td class="border_rconer IE6png" headers="17">
                &nbsp;
            </td>
        </tr>
    </table>
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    </telerik:RadScriptManager>
    <telerik:RadAjaxLoadingPanel runat="server" ID="LoadingPanel">
        </telerik:RadAjaxLoadingPanel>
        <telerik:RadWindowManager ID="Manager1" runat="server" EnableShadow="true" Skin="WebBlue">
         
        </telerik:RadWindowManager>
    </form>
    
</body>
</html>
<script type="text/javascript">
    var empGuid;
    var status;
    var workId;
    $(function () {
        empGuid = $("#<%= hdEmpGuid.ClientID%>").val();
        status = $("#<%= hdStatus.ClientID%>").val();
        workId = $("#<%= hdID.ClientID%>").val();
        Initial();
    });
    /*初始化页面*/
    function Initial() {
        $("#btnSave").click(function () {
            WorkExpSave("btnSave");
        });
        $("#btnCancel").click(function () {
            returnToParent(1);
            CloseClildWorkExpWin();
        });      
        if (status == "1") {
            GetWorkExp();
        }
        var  corpName=$("#hidCorpName").val();
        //结束时间输入控制
        $("#CheckEndTime").click(function () {
            if ($(this).attr("checked")) {
                $("#txtEndDate").val("至今");
                $("#txtEndDate").attr("disabled", "disabled");
                $("#txtCorpName").val(corpName);
            } else {
                $("#txtEndDate").val("");
                $("#txtCorpName").val("");
                $("#txtEndDate").removeAttr("disabled");
            }
        });
    }
    /*取得信息**/
    function GetWorkExp() {
        $.getJSON("PersonEmpWorkInfo.aspx", { "action": "GetWorkExp", "empGuid": empGuid, "workId": workId, "rand": Math.random() }, function (data) {
            if (data.length == 0 || data == null) {
                OpenAlert("未查询到有效数据！");
                return false;
            }
            if (data.result == 1) {
                OpenAlert(data.message);
                return false;
            }
            var items = data.data;
            if (items != null) {
                //客户端赋值
                SetControlVal("workexperience", items);
                if ($("#txtEndDate").val() == "至今") {
                    $("#CheckEndTime").attr("checked", "true");
                    $("#txtEndDate").attr("disabled", "disabled");
                }
                $("#<%=hidCurrentCorpName.ClientID %>").val(items.CorpName);
                
            }
        });
    }
    /*保存信息*/
    function WorkExpSave(btnId) {
        if (empGuid == "") {
            OpenAlert("请先添加人员信息！");
            return false;
        }
        //验证控件值
        var dataValid = CheckControlValid(btnId);
        if (!dataValid) {
            return false;
        }
        $("#" + btnId).attr("disabled", "disabled");
        if (status == "0") {
            WorkExpAdd(btnId, "WorkExpAdd");
        } else {
            WorkExpAdd(btnId, "WorkExpEdit");
        }
    }
    /*添加修改信息*/
    function WorkExpAdd(btnId, action) {
        var dataStr = GetData(btnId);//取得页面上输入的数据
        $.getJSON("PersonEmpWorkInfo.aspx", { "action": action, "empGuid": empGuid, "data": dataStr,"workCorp":$("#<%=hidCurrentCorpName.ClientID %>").val(), "rand": Math.random() }, function (data) {
            $("#" + btnId).removeAttr("disabled");
            OpenAlert(data.Message);

            if (data.Result) {
                WorkExpReset();
                returnToParent(0);
                if (action == "WorkExpEdit") {
                    CloseClildWorkExpWin();
                } 
            }
        });
    }

    function WorkExpReset() {
        $("#txtBeginDate").val("");
        $("#txtEndDate").val("");
        $("#CheckEndTime").removeAttr("checked");
        $("#txtCorpName").val("");
        $("#txtPost").val(""); 
    }
   
    /*关闭窗口*/
    function returnToParent(result) {
        var oArg = new Object();
        oArg.childWinName = "Work";
        oArg.Result = result;
        parent.window.OnClientClose(oArg);
            }
    function CloseClildWorkExpWin() {
        window.parent.$.ligerDialog.close(); ////关闭dialog
        parent.$(".l-dialog,.l-window-mask").hide(); ////去除父窗体遮罩层
        parent.window.focus();
    }
    function OpenAlert(text) {
        $.ligerDialog.warn(text);
        return false;
    } 
</script>
